package inventory.mappers;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import inventory.entity.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author sxt
 * @since 2019-11-06
 */

public interface UserMapper extends BaseMapper<User> {
    /**
     * @Description: 添加用户
     * @Param: User
     * @return: void
     * @Author: jwx
     * @Date: 2019/11/20
     */

    void setStatus(@Param("userId") String userId,@Param("status") String status);
    void addUser(User user);

    boolean isWorkIdExist(String workId);

    String queryRoleIdByUserId(String roleId);

    List<User> queryAllUser();

    List<User> queryUserByName(String username);

    String selectUserIdByWorkId(String workId);
    //判断用户是否存在
    boolean isUserExist(String userId);

@Select("select count(*) from user where role_id = #{roleId}")
    int getRoleNumByRoleId(String roleId);
@Select("select state from user where user_id=#{userId}")
    String getStatById(String userId);


    //---------------------------TTXXI START-------------------------------
    @Select("select * from user where work_id = #{workId}")
    User queryUserByWorkId(String workId);




    //---------------------------TTXXI END-------------------------------

    //--------------------------rhq---start------------------

    List<User> selectUserByRoleId(String roleId);




    //--------------------------rhq---end------------------
}
